<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/axios.js"></script>
    <script src="./js/api-备份.js"></script>
    <script>
        
        function loadList1(){
            loadTypes()
                .then(function(result){
                    // console.log(result);
                    let divDom = document.querySelector("#list1");
                    for (let i = 0; i < result.length; i++) {
                        let pDom = document.createElement("p");
                        pDom.innerHTML = result[i].typeName;
                        divDom.appendChild(pDom);
                    }
                })
                .catch(function(){
                    
                })
        }
        async function loadList2(){
            try {
                let result = await loadTypes();
                let divDom = document.querySelector("#list2");
                for (let i = 0; i < result.length; i++) {
                    let h5Dom = document.createElement("h5");
                    h5Dom.innerHTML = result[i].typeName;
                    divDom.appendChild(h5Dom);
                }
            } catch (error) {

            }               
        }
    </script>
</head>
<body>
    <input type="button" value="list1加载type数据" onclick="loadList1()">
    <div id="list1">
        
    </div>
    <hr>
    <input type="button" value="list2加载type数据" onclick="loadList2()">
    <div id="list2">
        
    </div>
</body>
</html>